package Visao;


import Controle.Conectabanco;

public class TelaPrincipal extends javax.swing.JFrame {

    Conectabanco conecta = new Conectabanco(); // variável global

    public TelaPrincipal() {
        initComponents();
        conecta.conexao();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenu4 = new javax.swing.JMenu();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu5 = new javax.swing.JMenu();
        jMenu6 = new javax.swing.JMenu();
        jMenu7 = new javax.swing.JMenu();
        Botao_clientes = new javax.swing.JMenuItem();
        jPanel1 = new javax.swing.JPanel();
        botao_cliente = new javax.swing.JButton();
        botao_usuario = new javax.swing.JButton();
        botao_produto = new javax.swing.JButton();
        jLabel_desenvolvedores1 = new javax.swing.JLabel();
        jMenuBar2 = new javax.swing.JMenuBar();
        menu_cadastros = new javax.swing.JMenu();
        jMenuItem4 = new javax.swing.JMenuItem();
        menuitem_clientes = new javax.swing.JMenuItem();
        menuitem_funcionarios = new javax.swing.JMenuItem();
        meniitem_fornecedores = new javax.swing.JMenuItem();
        Bairros = new javax.swing.JMenuItem();
        menuseparador_estoque = new javax.swing.JPopupMenu.Separator();
        menu_estoque = new javax.swing.JMenu();
        menuitem_produto = new javax.swing.JMenuItem();
        menuitem_venda = new javax.swing.JMenuItem();
        menuseparador_sair = new javax.swing.JPopupMenu.Separator();
        menuitem_sair = new javax.swing.JMenuItem();
        menu_relatorios = new javax.swing.JMenu();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenuItem7 = new javax.swing.JMenuItem();
        jMenuItem8 = new javax.swing.JMenuItem();
        menu_utilitarios = new javax.swing.JMenu();
        jMenuItem3 = new javax.swing.JMenuItem();
        menu_sair = new javax.swing.JMenu();

        jMenuItem1.setText("jMenuItem1");

        jMenuItem2.setText("jMenuItem2");

        jMenu4.setText("jMenu4");

        jMenu5.setText("File");
        jMenuBar1.add(jMenu5);

        jMenu6.setText("Edit");
        jMenuBar1.add(jMenu6);

        jMenu7.setText("jMenu7");

        Botao_clientes.setText("jMenuItem3");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Sistema para Controle de Estoque");
        setBackground(new java.awt.Color(204, 255, 204));

        jPanel1.setBackground(new java.awt.Color(0, 51, 204));

        botao_cliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/users1.png"))); // NOI18N
        botao_cliente.setText(" Cliente");
        botao_cliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botao_clienteActionPerformed(evt);
            }
        });

        botao_usuario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/businessman2.png"))); // NOI18N
        botao_usuario.setText("Usuário");
        botao_usuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botao_usuarioActionPerformed(evt);
            }
        });

        botao_produto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/package_add.png"))); // NOI18N
        botao_produto.setText("Produto");
        botao_produto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botao_produtoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(botao_usuario)
                .addGap(18, 18, 18)
                .addComponent(botao_cliente)
                .addGap(18, 18, 18)
                .addComponent(botao_produto)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(botao_produto)
                    .addComponent(botao_cliente))
                .addContainerGap())
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(botao_usuario)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jLabel_desenvolvedores1.setBackground(new java.awt.Color(255, 0, 0));
        jLabel_desenvolvedores1.setFont(new java.awt.Font("Verdana", 0, 10)); // NOI18N
        jLabel_desenvolvedores1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel_desenvolvedores1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/controle de estoque .png"))); // NOI18N

        menu_cadastros.setMnemonic('c');
        menu_cadastros.setText("Cadastros");

        jMenuItem4.setText("Usuario");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        menu_cadastros.add(jMenuItem4);

        menuitem_clientes.setText("Clientes");
        menuitem_clientes.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                menuitem_clientesMouseClicked(evt);
            }
        });
        menuitem_clientes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuitem_clientesActionPerformed(evt);
            }
        });
        menu_cadastros.add(menuitem_clientes);

        menuitem_funcionarios.setText("//Funcionários");
        menuitem_funcionarios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuitem_funcionariosActionPerformed(evt);
            }
        });
        menu_cadastros.add(menuitem_funcionarios);

        meniitem_fornecedores.setText("//Fornecedores");
        menu_cadastros.add(meniitem_fornecedores);

        Bairros.setText("//Bairros");
        Bairros.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BairrosActionPerformed(evt);
            }
        });
        menu_cadastros.add(Bairros);
        menu_cadastros.add(menuseparador_estoque);

        menu_estoque.setMnemonic('e');
        menu_estoque.setText("Estoque");

        menuitem_produto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/package_add.png"))); // NOI18N
        menuitem_produto.setText("Produto");
        menuitem_produto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuitem_produtoActionPerformed(evt);
            }
        });
        menu_estoque.add(menuitem_produto);

        menuitem_venda.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/moneybag_dollar.png"))); // NOI18N
        menuitem_venda.setText("Venda");
        menuitem_venda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuitem_vendaActionPerformed(evt);
            }
        });
        menu_estoque.add(menuitem_venda);

        menu_cadastros.add(menu_estoque);
        menu_cadastros.add(menuseparador_sair);

        menuitem_sair.setText("Sair");
        menuitem_sair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuitem_sairActionPerformed(evt);
            }
        });
        menu_cadastros.add(menuitem_sair);

        jMenuBar2.add(menu_cadastros);

        menu_relatorios.setMnemonic('r');
        menu_relatorios.setText("Relatórios");

        jMenuItem5.setText("Gerar Relatório de Clientes");
        menu_relatorios.add(jMenuItem5);

        jMenuItem6.setText("Gerar Relatório de Estoque");
        menu_relatorios.add(jMenuItem6);

        jMenuItem7.setText("Gerar Relatório de Vendas");
        menu_relatorios.add(jMenuItem7);

        jMenuItem8.setText("Gerar Relatório de Compras");
        menu_relatorios.add(jMenuItem8);

        jMenuBar2.add(menu_relatorios);

        menu_utilitarios.setMnemonic('u');
        menu_utilitarios.setText("Utilitários");

        jMenuItem3.setText("About");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        menu_utilitarios.add(jMenuItem3);

        jMenuBar2.add(menu_utilitarios);

        menu_sair.setMnemonic('s');
        menu_sair.setText("Sair");
        menu_sair.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                menu_sairMouseClicked(evt);
            }
        });
        menu_sair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menu_sairActionPerformed(evt);
            }
        });
        jMenuBar2.add(menu_sair);

        setJMenuBar(jMenuBar2);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jLabel_desenvolvedores1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel_desenvolvedores1, javax.swing.GroupLayout.PREFERRED_SIZE, 570, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void menuitem_clientesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuitem_clientesActionPerformed
        dispose();
        TelaCliente.main(null); // TODO add your handling code here:
    }//GEN-LAST:event_menuitem_clientesActionPerformed

    private void botao_clienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botao_clienteActionPerformed
        TelaCliente tcl = new TelaCliente();
        tcl.setVisible(true);

        dispose();
        TelaCliente.main(null);// TODO add your handling code here:
    }//GEN-LAST:event_botao_clienteActionPerformed

    private void menuitem_sairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuitem_sairActionPerformed
        System.exit(0);
    }//GEN-LAST:event_menuitem_sairActionPerformed

    private void menu_sairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menu_sairActionPerformed
        System.exit(0);
    }//GEN-LAST:event_menu_sairActionPerformed

    private void menu_sairMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menu_sairMouseClicked
        conecta.desconecta();
        System.exit(0);        // TODO add your handling code here:
    }//GEN-LAST:event_menu_sairMouseClicked

    private void menuitem_clientesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuitem_clientesMouseClicked
        dispose();
        TelaCliente.main(null);// TODO add your handling code here:
    }//GEN-LAST:event_menuitem_clientesMouseClicked

    private void menuitem_funcionariosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuitem_funcionariosActionPerformed
        TelaError666.main(null);        // TODO add your handling code here:
    }//GEN-LAST:event_menuitem_funcionariosActionPerformed

    private void BairrosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BairrosActionPerformed
        TelaError666.main(null);        // TODO add your handling code here:
    }//GEN-LAST:event_BairrosActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        dispose();
        TelaAbout.main(null);

    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void menuitem_produtoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuitem_produtoActionPerformed
        dispose();
        TelaCadastroProduto.main(null);// TODO add your handling code here:
    }//GEN-LAST:event_menuitem_produtoActionPerformed

    private void botao_usuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botao_usuarioActionPerformed

        dispose();
        TelaUsuario.main(null);// TODO add your handling code here:
    }//GEN-LAST:event_botao_usuarioActionPerformed

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
        dispose();
        TelaUsuario.main(null);

        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem4ActionPerformed

    private void botao_produtoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botao_produtoActionPerformed
        dispose();
        TelaCadastroProduto.main(null);

        // TODO add your handling code here:
    }//GEN-LAST:event_botao_produtoActionPerformed

    private void menuitem_vendaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuitem_vendaActionPerformed
        dispose();
        TelaVendaProduto.main(null);

        // TODO add your handling code here:
    }//GEN-LAST:event_menuitem_vendaActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new TelaPrincipal().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem Bairros;
    private javax.swing.JMenuItem Botao_clientes;
    private javax.swing.JButton botao_cliente;
    private javax.swing.JButton botao_produto;
    private javax.swing.JButton botao_usuario;
    private javax.swing.JLabel jLabel_desenvolvedores1;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenu jMenu6;
    private javax.swing.JMenu jMenu7;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuBar jMenuBar2;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JMenuItem jMenuItem8;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JMenuItem meniitem_fornecedores;
    private javax.swing.JMenu menu_cadastros;
    private javax.swing.JMenu menu_estoque;
    private javax.swing.JMenu menu_relatorios;
    private javax.swing.JMenu menu_sair;
    private javax.swing.JMenu menu_utilitarios;
    private javax.swing.JMenuItem menuitem_clientes;
    private javax.swing.JMenuItem menuitem_funcionarios;
    private javax.swing.JMenuItem menuitem_produto;
    private javax.swing.JMenuItem menuitem_sair;
    private javax.swing.JMenuItem menuitem_venda;
    private javax.swing.JPopupMenu.Separator menuseparador_estoque;
    private javax.swing.JPopupMenu.Separator menuseparador_sair;
    // End of variables declaration//GEN-END:variables
}
